﻿@using PagedList;
@using PagedList.Mvc;
@model PagedList.IPagedList<YuFeng.Models.New.News>
@{
    ViewBag.SecondTitle = "新闻中心";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var companyNews = Model.Where(o => o.Type == (int)YuFeng.Models.AppEnum.NewsType.CompanyNews);
    var inlineNews = Model.Where(o => o.Type == (int)YuFeng.Models.AppEnum.NewsType.InlineNews);

}
<div class="page-wrap">
    @Html.Partial("_Header")
    <div class="content">
        <img src="~/assets/images/newsCenter-1.png" />

        <div class="content-box clearfix">
            <p class="content-box-title">公司新闻</p>
            @if (companyNews.Count() == 0)
            {
                <p class="margin-top-20 text-center">暂无内容！</p>
            }
            else
            {
                foreach (var news in Model.Where(o => o.Type == (int)YuFeng.Models.AppEnum.NewsType.CompanyNews))
                {
                    <div class="news-item clearfix">
                        <div class="col-xs-3 no-padding">
                            <img class="show-big-img" src="@YuFeng.Web.Helpers.FilesHelper.GetNewsTitleImg(news.TitleImg)" />
                        </div>
                        <div class="col-xs-9 news-info">
                            <p class="news-title"><a href="/Home/NewsDetail?newsId=@news.Id">@news.Title</a></p>
                            <p class="news-summary">@news.Summary</p>
                        </div>
                    </div>
                }
            }
        </div>
        <div class="content-box clearfix">
            <p class="content-box-title">行业新闻</p>
            @if (inlineNews.Count() == 0)
            {
                <p class="margin-top-20 text-center">暂无内容！</p>
            }
            else
            {
                foreach (var news in Model.Where(o => o.Type == (int)YuFeng.Models.AppEnum.NewsType.InlineNews))
                {
                    <div class="news-item clearfix">
                        <div class="col-xs-3 no-padding">
                            <img class="show-big-img" src="@YuFeng.Web.Helpers.FilesHelper.GetNewsTitleImg(news.TitleImg)" />
                        </div>
                        <div class="col-xs-9 news-info">
                            <p class="news-title"><a href="/Home/NewsDetail?newsId=@news.Id">@news.Title</a></p>
                            <p class="news-summary">@news.Summary</p>
                        </div>
                    </div>
                }
            }
        </div>
    </div>
    @Html.Partial("_Footer")
</div>
@section scripts
{
    <script type="text/javascript">
        var preLoading = function (events) {
            var images = [];
            var imgs = document.images;
            for (var i = 0; i < imgs.length; i++) {
                images.push(imgs[i].src);
            }

            @*images.push('@Url.Content("~/assets/images/banner-1.png")');
            images.push('@Url.Content("~/assets/images/logo.png")');
            images.push('@Url.Content("~/assets/images/menu-1.png")');
            images.push('@Url.Content("~/assets/images/menu-2.png")');
            images.push('@Url.Content("~/assets/images/menu-3.png")');
            images.push('@Url.Content("~/assets/images/menu-4.png")');
            images.push('@Url.Content("~/assets/images/menu-5.png")');*@

            imgLoading(images, {
                complete: function () {
                    events.complete();
                }
            });
        };
        $(function () {
            preLoading({
                complete: function () {
                    // 页面预加载结束；
                    $(".loader").hide();
                    $(".page-wrap").show();
                }
            });
        });
    </script>
}


